<?php
/**
 * @ Fmash Top System
 * @ version: 3.0
 * @ author: i.coffee.smile@mail.com
 * @ date:2011-1-27
 * @ file:count.php $5
 */
session_start();
include_once 'class_mysql.php';
include_once 'function_math.php';

$de = deid($_GET['c']);
$id1 = $de['id1'];
$id2 = $de['id2'];

if(time() - $de['detime'] < 10)
{
	if($id1 > 0 && $id1 < 10000 && $id2 > 0 && $id2 < 10000)
	{
		$sql1 = "UPDATE `$top_man` SET `win` = `win` + 1 WHERE `sid` = '$id1'";
		$sql2 = "UPDATE `$top_man` SET `lose` = `lose` + 1 WHERE `sid` = '$id2'";
		if($_SESSION['lastwin'] == "$id1" && $_SESSION['lastlose'] == "$id2")
		{
			$error = rawurlencode('对不起，请不要连续提交！');
			header("location:error.php?error=$error");
			exit();
		}else{
			mysql_query($sql1);
			mysql_query($sql2);
		}
		$_SESSION['lastwin'] = "$id1";
		$_SESSION['lastlose'] = "$id2";
	}
}
header('location:index.php');